package com.suxin.logger.formatter;

import com.suxin.logger.LogRecord;

import java.util.Date;

/**
 * @author Tang
 * @classname SimpleFormatter
 * @description [  ]
 * @date 2022/4/26 22:13
 */
public class SimpleFormatter extends Formatter {

    private static final String format = "%1$tb %1$td, %1$tY %1$tl:%1$tM:%1$tS %1$Tp %2$s%n%4$s: %5$s%6$s%n";

    private final Date dat = new Date();

    @Override
    public String format(LogRecord lr) {
        dat.setTime(lr.getMillis());
        String message = formatMessage(lr);

        return String.format(
                message,
                dat,
                "",
                lr.getLoggerName(),
                message,
                ""
                );
    }

}